package com.flydog.taskManager.common.api;

import lombok.*;
import lombok.extern.slf4j.Slf4j;

/**
 * Api统一异常
 *
 * @author caoweidong
 * @version 0.0.0
 * @create 2021/6/28 9:52
 */

@Slf4j
@Getter
@Setter
public class ApiException extends RuntimeException {
    private long errorCode;
    private String errorMsg;

    public ApiException() {
        super();
    }

    public ApiException(IErrorCode code) {
        super(String.valueOf(code.getCode()));
        this.errorCode = code.getCode();
        this.errorMsg = code.getMessage();
    }

    public ApiException(long code, String msg) {
        this.errorMsg = msg;
        this.errorCode = code;

    }

    @Override
    public synchronized Throwable fillInStackTrace() {
        return this;
    }
}
